/** 
 * @(#)VOcache.java 1.0.0 2015年10月8日 下午1:34:00  
 *  
 * Copyright © 2015 善林金融.  All rights reserved.  
 */ 

package com.common;

import java.lang.reflect.Method;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
/**   
 * 
 * 缓存对象的属性名，列名，get方法
 * @author  HuYaHui
 * @version $Revision:1.0.0, $Date: 2015年10月8日 下午1:34:00 $ 
 */
public class VOcache {
	private static VOcache vo=new VOcache();
	
	//对象全路径-->VO
	private Map<String,VO> objToVO=new Hashtable<String, VO>();
	//对象全路径，列名-->属性名
	private Map<String,Map<String,Object>> columnToFieldName=new Hashtable<String, Map<String,Object>>();
	//对象全路径，属性名-->列名 
	private Map<String,Map<String,Object>> fieldNameToColumn=new Hashtable<String, Map<String,Object>>();
	//对象全路径，属性名-->method对象  
	private Map<String,Map<String,Method>> fieldNameToMethod=new Hashtable<String, Map<String,Method>>();
	//对象全路径，属性集合 
	private Map<String,List<String>> fieldListMap=new Hashtable<String, List<String>>();
	
	
	public static VO getObjToVO(Object obj){
		String obj_name=obj.getClass().getName();
		return vo.objToVO.get(obj_name);
	}
	public static void setObjToVO(Object obj,VO _vo){
		String obj_name=obj.getClass().getName();
		vo.objToVO.put(obj_name, _vo);
	}
	
	public static Map<String, Object> getColumnToFieldName(Object obj) {
		String obj_name=obj.getClass().getName();
		return vo.columnToFieldName.get(obj_name);
	}
	public static void setColumnToFieldName(Object obj,
			Map<String, Object> columnToFieldName) {
		String obj_name=obj.getClass().getName();
		vo.columnToFieldName.put(obj_name, columnToFieldName);
	}
	
	public static Map<String, Object> getFieldNameToColumn(Object obj) {
		String obj_name=obj.getClass().getName();
		return vo.fieldNameToColumn.get(obj_name);
	}
	
	public static void setFieldNameToColumn(Object obj,Map<String, Object> fieldNameToColumn) {
		String obj_name=obj.getClass().getName();
		vo.fieldNameToColumn.put(obj_name, fieldNameToColumn);
	}
	
	public static Map<String, Method> getFieldNameToMethod(Object obj) {
		String obj_name=obj.getClass().getName();
		return vo.fieldNameToMethod.get(obj_name);
	}
	public static void setFieldNameToMethod(Object obj,Map<String, Method> fieldNameToMethod) {
		String obj_name=obj.getClass().getName();
		vo.fieldNameToMethod.put(obj_name, fieldNameToMethod);
	}
	
	public static List<String> getFieldList(Object obj) {
		String obj_name=obj.getClass().getName();
		return vo.fieldListMap.get(obj_name);
	}
	public static void setFieldList(Object obj,List<String> fieldList) {
		String obj_name=obj.getClass().getName();
		vo.fieldListMap.put(obj_name, fieldList);
	}
	
	
}
